/*
 * File     : DoubleReference.java
 * Created  : 13 May 2011
 *
 * Copyright © 2011 Matthew Wilson (mj. {my-surname} .uk {at} gmail.com)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.googlecode.dni.type;

import com.googlecode.dni.type.utility.DoubleStructure;


/**
 * <p>
 *  Encapsulates a reference to a numeric <code>double</code> value that can be
 *  passed to a native function.
 * </p>
 * <p>
 *  When passed to a native function, the pointer to a slot is passed, allowing
 *  the caller to then retrieve a value set by the native function.  Native
 *  memory is only allocated when the function call is made, and lasts only for
 *  the duration of the call.
 * </p>
 * <p>
 *  Note that this type maps to a pointer to a <em>single</em> value only, not a
 *  list of values.
 * </p>
 *
 * @see ObjectReference
 * @see DoubleStructure
 *
 * @author Matthew Wilson
 */
public final class DoubleReference
{

    private double value;


    /**
     * @param value
     *            the initial value
     */
    public DoubleReference( final double value )
    {
        this.value = value;
    }

    /**
     * Obtains the value.
     *
     * @return the value
     */
    public double getValue()
    {
        return this.value;
    }

    /**
     * Sets the value.
     *
     * @param value
     *            the value to set
     */
    public void setValue( final double value )
    {
        this.value = value;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString()
    {
        return "DoubleReference[" + this.value + "]";
    }

}
